package mvc.form;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullForm {
public static ActionForm fullForm(String className,HttpServletRequest request){
	ActionForm form = null;
	try {
		Class clazz = Class.forName(className);
		form = (ActionForm)clazz.newInstance();
		Field[] fields =  clazz.getDeclaredFields();
		for(Field f : fields){
			f.setAccessible(true);
			f.set(form,request.getParameter(f.getName()));
			f.setAccessible(false);
		}
		
	} catch (Exception e) {
		System.out.println("严重：form装载失败！");
	}
	
	return form;
}
}
